#pragma once
#include<iostream>
#include"RBTree.h"

namespace zh
{
	template<class K>
	class set
	{
		struct setKeyOf
		{
			const K& operator()(const K& data)
			{
				return data;
			}
		};
	public:
		typedef typename BRTree<K, K, setKeyOf>::Iterator iterator;
		typedef typename BRTree<K, K, setKeyOf>::const_Iterator const_iterator;
		pair<iterator, bool> insert(const K& data)
		{
			return _t.Insert(data);
		}
		iterator begin()
		{
			return _t.Begin();
		}
		iterator end()
		{
			return _t.End();
		}
		const_iterator begin() const
		{
			return _t.Begin();
		}
		const_iterator end() const
		{
			return _t.End();
		}
		iterator find(const K& data)
		{
			return _t.Find(data);
		}
	private:
		BRTree<K, K, setKeyOf> _t;
	};
}
void text1( const zh::set<int> s)
{
	auto it = s.begin();
	while (it != s.end())
	{
		cout << *it << endl;
		++it;
	}
}
void settest()
{
	zh::set<int> s;
	s.insert(1);
	s.insert(2);
	s.insert(4);
	s.insert(3);
	zh::set<int>::iterator it = s.begin();
	zh::set<int> s1(s);
	zh::set<int> s2;
	s2 = s;
	//auto e = s.find(1);
	//while (it != s.end())
	//{
	//	cout << *it << endl;
	//	++it;
	//}
	text1(s);
}
